
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>svg 基本图形 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../svg之path/svg之path.html" />
    
    
    <link rel="prev" href="../svg基础/svg基础.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../svg基础/svg基础.html">
            
                <a href="../svg基础/svg基础.html">
            
                    
                    svg 基础
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3" data-path="svg基本图形.html">
            
                <a href="svg基本图形.html">
            
                    
                    svg 基本图形
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../svg之path/svg之path.html">
            
                <a href="../svg之path/svg之path.html">
            
                    
                    svg 之 path
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../svg描边动画/svg描边动画.html">
            
                <a href="../svg描边动画/svg描边动画.html">
            
                    
                    svg 描边动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../svg之fill及fill-rule/svg之fill及fill-rule.html">
            
                <a href="../svg之fill及fill-rule/svg之fill及fill-rule.html">
            
                    
                    svg 之 fill 及 fill-rule
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../svg之viewBox/svg之viewBox.html">
            
                <a href="../svg之viewBox/svg之viewBox.html">
            
                    
                    svg 之 viewBox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../svg分组与复用/svg分组与复用.html">
            
                <a href="../svg分组与复用/svg分组与复用.html">
            
                    
                    svg 分组与复用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../svg之marker/svg之marker.html">
            
                <a href="../svg之marker/svg之marker.html">
            
                    
                    svg 之 marker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../svg文本/svg文本.html">
            
                <a href="../svg文本/svg文本.html">
            
                    
                    svg 文本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../svg之pattern/svg之pattern.html">
            
                <a href="../svg之pattern/svg之pattern.html">
            
                    
                    svg 之 pattern
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../svg之clipPath和mask/svg之clipPath和mask.html">
            
                <a href="../svg之clipPath和mask/svg之clipPath和mask.html">
            
                    
                    svg 之 clipPath 和 mask
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../svg之filter/svg之filter.html">
            
                <a href="../svg之filter/svg之filter.html">
            
                    
                    svg 之 filter
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >svg 基本图形</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="svg-&#x57FA;&#x672C;&#x56FE;&#x5F62;">SVG &#x57FA;&#x672C;&#x56FE;&#x5F62;</h1>
<p>SVG &#x4E2D;&#x57FA;&#x672C;&#x56FE;&#x5F62;&#x5305;&#x62EC;&#x76F4;&#x7EBF;&#x3001;&#x6298;&#x7EBF;&#x3001;&#x77E9;&#x5F62;&#x3001;&#x5706;&#x5F62;&#x3001;&#x692D;&#x5706;&#x3001;&#x591A;&#x8FB9;&#x5F62;&#x3002;</p>
<h2 id="&#x76F4;&#x7EBF;-line">&#x76F4;&#x7EBF; <code>&lt;line&gt;</code></h2>
<p><img src="imgs/line.svg" alt="line"></p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">line</span> <span class="hljs-attr">x1</span>=<span class="hljs-string">&quot;100&quot;</span> <span class="hljs-attr">y1</span>=<span class="hljs-string">&quot;100&quot;</span> <span class="hljs-attr">x2</span>=<span class="hljs-string">&quot;300&quot;</span> <span class="hljs-attr">y2</span>=<span class="hljs-string">&quot;100&quot;</span>/&gt;</span>
</code></pre>
<ul>
<li><code>x1, y1</code>&#xFF1A;&#x8868;&#x793A;&#x76F4;&#x7EBF;&#x8D77;&#x70B9;&#x7684;&#x6A2A;&#x5750;&#x6807;&#x548C;&#x7EB5;&#x5750;&#x6807;&#x3002;</li>
<li><code>x2, y2</code>&#xFF1A;&#x8868;&#x793A;&#x76F4;&#x7EBF;&#x7EC8;&#x70B9;&#x7684;&#x6A2A;&#x5750;&#x6807;&#x548C;&#x7EB5;&#x5750;&#x6807;&#x3002;</li>
</ul>
<h2 id="&#x6298;&#x7EBF;-polyline">&#x6298;&#x7EBF; <code>&lt;polyline&gt;</code></h2>
<p><img src="imgs/polyline.svg" alt="polyline"></p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">polyline</span> <span class="hljs-attr">points</span>=<span class="hljs-string">&quot;100, 150 150, 50 200, 100 250, 50 300, 100&quot;</span>/&gt;</span>
</code></pre>
<ul>
<li><code>points</code>&#xFF1A;&#x8868;&#x793A;&#x6298;&#x7EBF;&#x6BCF;&#x4E2A;&#x7AEF;&#x70B9;&#x7684;&#x5750;&#x6807;&#x3002;&#x6A2A;&#x5750;&#x6807;&#x4E0E;&#x7EB5;&#x5750;&#x6807;&#x4E4B;&#x95F4;&#x7528;&#x9017;&#x53F7;&#x5206;&#x9694;&#xFF0C;&#x70B9;&#x4E0E;&#x70B9;&#x4E4B;&#x95F4;&#x7528;&#x7A7A;&#x683C;&#x5206;&#x9694;&#x3002;</li>
</ul>
<h2 id="&#x77E9;&#x5F62;-rect">&#x77E9;&#x5F62; <code>&lt;rect&gt;</code></h2>
<p><img src="imgs/rect.svg" alt="rect"></p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">rect</span> <span class="hljs-attr">x</span>=<span class="hljs-string">&quot;100&quot;</span> <span class="hljs-attr">y</span>=<span class="hljs-string">&quot;50&quot;</span> <span class="hljs-attr">width</span>=<span class="hljs-string">&quot;200&quot;</span> <span class="hljs-attr">height</span>=<span class="hljs-string">&quot;100&quot;</span> /&gt;</span>
</code></pre>
<ul>
<li>x, y&#xFF1A;&#x8868;&#x793A;&#x77E9;&#x5F62;&#x5DE6;&#x4E0A;&#x89D2;&#x7AEF;&#x70B9;&#x7684;&#x6A2A;&#x5750;&#x6807;&#x548C;&#x7EB5;&#x5750;&#x6807;&#x3002;</li>
<li>width&#xFF1A;&#x8868;&#x793A;&#x77E9;&#x5F62;&#x7684;&#x5BBD;&#x3002;</li>
<li>height&#xFF1A;&#x8868;&#x793A;&#x77E9;&#x5F62;&#x7684;&#x9AD8;&#x3002;</li>
</ul>
<h2 id="&#x5706;-circle">&#x5706; <code>&lt;circle&gt;</code></h2>
<p><img src="imgs/circle.svg" alt="circle"></p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">circle</span> <span class="hljs-attr">cx</span>=<span class="hljs-string">&quot;200&quot;</span> <span class="hljs-attr">cy</span>=<span class="hljs-string">&quot;100&quot;</span> <span class="hljs-attr">r</span>=<span class="hljs-string">&quot;80&quot;</span>/&gt;</span>
</code></pre>
<ul>
<li>cx, cy&#xFF1A;&#x8868;&#x793A;&#x5706;&#x7684;&#x5706;&#x5FC3;&#x7684;&#x6A2A;&#x5750;&#x6807;&#x548C;&#x7EB5;&#x5750;&#x6807;&#x3002;</li>
<li>r&#xFF1A;&#x8868;&#x793A;&#x5706;&#x7684;&#x534A;&#x5F84;&#x3002;</li>
</ul>
<h2 id="&#x692D;&#x5706;-ellipse">&#x692D;&#x5706; <code>&lt;ellipse&gt;</code></h2>
<p><img src="imgs/ellipse.svg" alt="ellipse"></p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ellipse</span> <span class="hljs-attr">cx</span>=<span class="hljs-string">&quot;200&quot;</span> <span class="hljs-attr">cy</span>=<span class="hljs-string">&quot;100&quot;</span> <span class="hljs-attr">rx</span>=<span class="hljs-string">&quot;100&quot;</span> <span class="hljs-attr">ry</span>=<span class="hljs-string">&quot;60&quot;</span>/&gt;</span>
</code></pre>
<ul>
<li>cx, cy&#xFF1A;&#x8868;&#x793A;&#x692D;&#x5706;&#x4E2D;&#x5FC3;&#x7684;&#x6A2A;&#x5750;&#x6807;&#x548C;&#x7EB5;&#x5750;&#x6807;&#x3002;</li>
<li>rx&#xFF1A;&#x8868;&#x793A;&#x692D;&#x5706;&#x6A2A;&#x5411;&#x8F74;&#x7684;&#x534A;&#x5F84;&#x3002;</li>
<li>ry&#xFF1A;&#x8868;&#x793A;&#x692D;&#x5706;&#x7EB5;&#x5411;&#x8F74;&#x7684;&#x534A;&#x5F84;&#x3002;</li>
</ul>
<h2 id="&#x591A;&#x8FB9;&#x5F62;-polygon">&#x591A;&#x8FB9;&#x5F62; <code>&lt;polygon&gt;</code></h2>
<p><img src="imgs/polygon.svg" alt="polygon"></p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">polygon</span> <span class="hljs-attr">points</span>=<span class="hljs-string">&quot;100, 150 150, 50 200, 100 250, 50 300, 100&quot;</span>/&gt;</span>
</code></pre>
<ul>
<li><code>points</code>&#xFF1A;&#x8868;&#x793A;&#x591A;&#x8FB9;&#x5F62;&#x6BCF;&#x4E2A;&#x7AEF;&#x70B9;&#x7684;&#x5750;&#x6807;&#x3002;&#x6A2A;&#x5750;&#x6807;&#x4E0E;&#x7EB5;&#x5750;&#x6807;&#x4E4B;&#x95F4;&#x7528;&#x9017;&#x53F7;&#x5206;&#x9694;&#xFF0C;&#x70B9;&#x4E0E;&#x70B9;&#x4E4B;&#x95F4;&#x7528;&#x7A7A;&#x683C;&#x5206;&#x9694;&#x3002;</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../svg基础/svg基础.html" class="navigation navigation-prev " aria-label="Previous page: svg 基础">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../svg之path/svg之path.html" class="navigation navigation-next " aria-label="Next page: svg 之 path">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"svg 基本图形","level":"1.3","depth":1,"next":{"title":"svg 之 path","level":"1.4","depth":1,"path":"svg之path/svg之path.md","ref":"./svg之path/svg之path.md","articles":[]},"previous":{"title":"svg 基础","level":"1.2","depth":1,"path":"svg基础/svg基础.md","ref":"./svg基础/svg基础.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"svg基本图形/svg基本图形.md","mtime":"2019-10-21T03:13:48.939Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-10-21T06:03:10.264Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

